/* eslint-disable no-unused-vars */
import React, { useState } from "react";
import { HashRouter as Router, Route, Switch } from "react-router-dom";
import Order from '../views/Order';
import Orderlist from "../views/Orderlist";
import Parta from '../views/Parta';
import Partb from '../views/Partb';
import ProductColor from "../views/ProductColor";
import ProductDirection from "../views/ProductDirection";
import ProductLight from "../views/ProductLight";
import ProductName from "../views/ProductName";

export default function Index() {
    const [menuRouter, setMenuRouter] = useState([
        {
            id: 1,
            path: "/menu",
            name: "parta",
            component: Parta,
            exact: true
        },
        {
            id: 2,
            path: "/menu/parta",
            name: "parta",
            component: Parta
        },
        {
            id: 3,
            path: "/menu/partb",
            name: "partb",
            component: Partb
        },
        {
            id: 4,
            path: "/menu/productname",
            name: "productname",
            component: ProductName
        },
        {
            id: 5,
            path: "/menu/productcolor",
            name: "productcolor",
            component: ProductColor
        },
        {
            id: 6,
            path: "/menu/productdirection",
            name: "productdirection",
            component: ProductDirection
        },
        {
            id: 7,
            path: "/menu/productlight",
            name: "productlight",
            component: ProductLight
        },
        {
            id: 8,
            path: "/menu/order",
            name: "order",
            component: Order
        },
        {
            id: 9,
            path: "/menu/orderlist",
            name: "orderlist",
            component: Orderlist
        },

    ])
    return (
        <Router>
            <Switch>
                {menuRouter.map((item) => {
                    return (
                        <Route
                            key={item.id}
                            path={item.path}
                            component={item.component}
                            exact={item.exact}
                        ></Route>
                    );
                })}
            </Switch>
        </Router>
    )
}